home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / Libraries / VideoToolbox 96.06.15 / VideoToolboxSources / Zoom.c < prev   
Text File  |  1994-11-15  |  2KB  |  49 lines

  1. /*
  2. Zoom.c 
  3. 10/17/90    dgp    translated from pascal DoWZoom.p in Inside Mac VI.
  4. 10/18/90 dgp    removed part of the code to make GetWindowDevice(), which I put
  5.                 in GetScreenDevice.c
  6. 8/24/91    dgp        Made compatible with THINK C 5.0.
  7. 12/27/91 dgp    Extracted code to create TitleBarHeight.c
  8. 3/26/92    dgp        Replaced use of SysEnvirons() by a call to QD8Exists().
  9. 6/3/94    dgp    replaced low-memory global MBarHeight by GetMBarHeight().
  10. 6/12/94    dgp    changed "theEvent" from a global to an argument "event", passed by address.
  11. */
  12. #include "VideoToolbox.h"
  13. #if UNIVERSAL_HEADERS
  14.     #include <LowMem.h>
  15. #else
  16.     #define LMGetMBarHeight() (* (short *) 0x0BAA)
  17.     #define LMSetMBarHeight(MBarHeightValue) ((* (short *) 0x0BAA) = (MBarHeightValue))
  18. #endif
  19.  
  20. void Zoom(WindowPtr theWindow,int zoomDir,EventRecord *event)
  21. {
  22.     Rect r;
  23.     GDHandle dominantGDevice;
  24.     int headRoom;
  25.     GrafPtr savePort;
  26.     
  27.     if(TrackBox(theWindow,event->where,zoomDir)){
  28.         GetPort(&savePort);
  29.         SetPort(theWindow);
  30.         EraseRect(&theWindow->portRect);        /*recommended for cosmetic reasons*/
  31.         /* If there is the possibility of multiple gDevices, then we */
  32.         /* must check them to make sure we are zooming onto the right */
  33.         /* display device when zooming out. */
  34.         if(zoomDir==inZoomOut && QD8Exists()){
  35.             headRoom=TitleBarHeight(theWindow);
  36.             /* We must create a zoom rectangle manually in this case. */
  37.             /* Account for menu bar height as well, if on main device */
  38.             dominantGDevice=GetWindowDevice(theWindow);
  39.             if(dominantGDevice==GetMainDevice()) headRoom += LMGetMBarHeight();
  40.             r=(*dominantGDevice)->gdRect;
  41.             SetRect(&r,r.left+3,r.top+headRoom+3,r.right-3,r.bottom-3);
  42.             /* Set up the WStateData record for this window. */
  43.             (*((WStateData **)((WindowPeek)theWindow)->dataHandle))->stdState = r;
  44.         }
  45.         ZoomWindow(theWindow,zoomDir,TRUE);
  46.         SetPort(savePort);
  47.     }
  48. }
  49.